home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 2010 April / PCWorld0410.iso / pluginy Firefox / 1146 / 1146.xpi / chrome / screengrab.jar / content / AddToToolbar.js < prev    next >
Text File  |  2009-03-09  |  1KB  |  32 lines

  1. /**
  2.  * @author andy
  3.  */
  4. screengrab.addToToolbar = function() {
  5.     if (!screengrab.prefs.toolbarAddedOnce()) {
  6.         try {
  7.             var firefoxnav = document.getElementById("nav-bar");
  8.             screengrab.debug(firefoxnav);
  9.             var curSet = firefoxnav.currentSet;
  10.             screengrab.debug(curSet);
  11.             if (curSet.indexOf("screengrab-toolbar-button") == -1) {
  12.                 screengrab.debug("adding");
  13.                 var set = firefoxnav.currentSet + ",screengrab-toolbar-button";
  14.                 firefoxnav.setAttribute("currentset", set);
  15.                 firefoxnav.currentSet = set;
  16.                 document.persist("nav-bar", "currentset");
  17.                 // If you don't do the following call, funny things happen
  18.                 try {
  19.                     BrowserToolboxCustomizeDone(true);
  20.                 } catch (e) {
  21.                     screengrab.error(e);
  22.                 }
  23.             }
  24.         } catch(e) {
  25.             screengrab.error(e);
  26.         }
  27.         screengrab.prefs.setToolbarAddedOnce();
  28.     }
  29. }
  30. window.addEventListener("load", function() {
  31.     screengrab.addToToolbar();
  32. }, false);